//
//  NSOperationDemo2ViewController.m
//  多线程编程
//
//  Created by GR on 2017/7/15.
//  Copyright © 2017年 GR Harry. All rights reserved.
//

#import "NSOperationDemo2ViewController.h"

@interface NSOperationDemo2ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *OP1;
@property (weak, nonatomic) IBOutlet UILabel *OP2;
@property (weak, nonatomic) IBOutlet UILabel *Total;
@end

@implementation NSOperationDemo2ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
       [self startOperation];
    });
}

- (void)startOperation {
    
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    
    __block NSInteger op1Completed = 0;
    __block NSInteger op2Completed = 0;
    __block NSInteger totalCompeted = 0;
    
    NSBlockOperation *op1 = [NSBlockOperation blockOperationWithBlock:^{
        for (int i = 0; i < 5; i++) {
            sleep(1);
            op1Completed++;
            
            
        }
    }];
    
    NSBlockOperation *op2 = [NSBlockOperation blockOperationWithBlock:^{
        
    }];
}

@end
